package com.linkage.educloud.ah.bean;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Mr'Tang on 2018/12/19.
 */

public class BrandAreaBean {
    private String name;//名称
    private int id;//品牌或应用id
    private int type;//品牌类型1 品牌集，2 单独应用 ，3 本地应用 ，4 地市频道
    private String resicon;//	展示图地址

    public static List<BrandAreaBean> parseFromJson(JSONArray jsonArray) {
        List<BrandAreaBean> list = new ArrayList<>();
        for (int a = 0; a < jsonArray.length(); a++) {
            BrandAreaBean bean = new BrandAreaBean();
            JSONObject jsonObj = null;
            try {
                jsonObj = jsonArray.getJSONObject(a);
            } catch (JSONException e) {
                e.printStackTrace();
            }
            bean.setName(jsonObj.optString("name"));
            bean.setResicon(jsonObj.optString("resicon"));
            bean.setId(jsonObj.optInt("id"));
            bean.setType(jsonObj.optInt("type"));
            list.add(bean);
        }
        return list;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getResicon() {
        return resicon;
    }

    public void setResicon(String resicon) {
        this.resicon = resicon;
    }
}
